package com.ssy.lingxi.order.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 交易流程规则关联的合同
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-24
 */
@Entity
@Table(schema = "public", name = "ord_trade_process_contract", indexes = {@Index(name = "ord_trade_process_contract_trade_process_id", columnList = "trade_process_id")})
public class OrderTradeProcessContractDO implements Serializable {
    private static final long serialVersionUID = -469922005401022171L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_trade_process_contract_seq")
    @SequenceGenerator(sequenceName = "ord_trade_process_contract_seq", name = "ord_trade_process_contract_seq", allocationSize = 1)
    private Long id;

    /**
     * 一对一双向关联交易流程规则
     */
    @JsonBackReference
    @OneToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name="trade_process_id", referencedColumnName="id")
    private OrderTradeProcessDO process;

    /**
     * 来自合同服务的合同模板Id
     */
    @Column
    private Long contractId;

    /**
     * 合同模板名称
     */
    @Column(columnDefinition = "varchar(50)")
    private String contractName;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public OrderTradeProcessDO getProcess() {
        return process;
    }

    public void setProcess(OrderTradeProcessDO process) {
        this.process = process;
    }

    public Long getContractId() {
        return contractId;
    }

    public void setContractId(Long contractId) {
        this.contractId = contractId;
    }

    public String getContractName() {
        return contractName;
    }

    public void setContractName(String contractName) {
        this.contractName = contractName;
    }
}
